<?php
    class admin_catalog_controller extends controllerBase
    {
        public function process()
        {
            $aSettings = database::getListSettings('theme');
            $this->aParams['aSettings'] = $aSettings;
            
            database::isAdmin(true);
            $oDatabase = new database();
            
            $sQuery = " PREFIX foaf: <http://xmlns.com/foaf/0.1/>
                        PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
                        PREFIX dc: <http://purl.org/dc/elements/1.1/>
                        PREFIX bus: <".URL::getLink('id/bussiness#').">

                        SELECT * 
                        WHERE
                        {
                          ?uri rdf:type bus:category.
                          ?uri bus:name ?name. 
                          OPTIONAL{?uri bus:defaultImage ?image}
                          OPTIONAL{?uri bus:defaultProductLayout ?defaultProductLayout.}
                          OPTIONAL
                          {                            
                            ?uri bus:subCategory ?pCategoryUri.
                            ?pCategoryUri bus:name ?pCategoryName.
                          }
                        } ";

            $aCategories = $oDatabase->loadQuery($sQuery);
            $this->aParams['aCategories'] = $aCategories['result']['rows'];
        }
    }
?>